(function(){"use strict";BX.namespace("BX.UI.Notification");var t=null;Object.defineProperty(BX.UI.Notification,"Center",{enumerable:false,get:function(){if(t===null){t=new BX.UI.Notification.Manager({})}return t}});BX.UI.Notification.Manager=function(){this.stacks=Object.create(null);this.balloons=Object.create(null);this.balloonDefaults={};this.stackDefaults={};this.defaultPosition=BX.UI.Notification.Position.TOP_RIGHT;BX.addCustomEvent(BX.UI.Notification.Event.getFullName("onClose"),this.handleBalloonClose.bind(this))};BX.UI.Notification.Manager.prototype={notify:function(t){t=BX.type.isPlainObject(t)?t:{};var i=this.getBalloonById(t.id)||this.getBalloonByCategory(t.category);if(i){i.setOptions(t);i.show();if(t.blinkOnUpdate===false){i.update(null)}else{i.blink()}return}var o=null;if(t.stack instanceof BX.UI.Notification.Stack){o=t.stack;this.addStack(o)}else{if(BX.type.isNotEmptyString(t.position)){o=this.getStackByPosition(t.position)}else{o=this.getDefaultStack()}t.stack=o}var n=BX.mergeEx({},this.getBalloonDefaults(),t);var e=o.getBalloonType(t.type);var a=new e(n);if(!(a instanceof BX.UI.Notification.Balloon)){throw new Error("Balloon type must be an instance of BX.UI.Notification.Balloon")}this.balloons[a.getId()]=a;a.show();return a},getBalloonById:function(t){return this.balloons[t]?this.balloons[t]:null},getBalloonByCategory:function(t){if(BX.type.isNotEmptyString(t)){for(var i in this.balloons){var o=this.balloons[i];if(o.getCategory()===t){return o}}}return null},removeBalloon:function(t){delete this.balloons[t.getId()]},handleBalloonClose:function(t){this.removeBalloon(t.getBalloon())},getStack:function(t){return this.stacks[t]?this.stacks[t]:null},getDefaultStack:function(){return this.getStackByPosition(this.getDefaultPosition())},getStackByPosition:function(t){var i=this.getStack(t);if(i===null){i=new BX.UI.Notification.Stack(BX.mergeEx({},this.getStackDefaults(),{id:t,position:t}));this.addStack(i)}return i},addStack:function(t){if(t instanceof BX.UI.Notification.Stack&&this.getStack(t.getId())===null){this.stacks[t.getId()]=t}},setBalloonDefaults:function(t){if(BX.type.isPlainObject(t)){BX.mergeEx(this.balloonDefaults,t)}},getBalloonDefaults:function(){return this.balloonDefaults},setStackDefaults:function(t,i){if(BX.UI.Notification.Stack.getPositionCode(t)){var o=this.getStackByPosition(t);o.setOptions(i)}else if(BX.type.isPlainObject(t)){i=t;for(var n in BX.UI.Notification.Position){t=BX.UI.Notification.Position[n];this.setStackDefaults(t,i)}}},setDefaultPosition:function(t){if(BX.UI.Notification.Stack.getPositionCode(t)){this.defaultPosition=t}},getDefaultPosition:function(){return this.defaultPosition},getStackDefaults:function(){return this.stackDefaults}}})();
//# sourceMappingURL=ui.notification.center.map.js